/**
 * 打尺记录
 * Created by 11057 on 2018/2/28.
 */
import {Injectable} from '@angular/core';
import {HttpParams} from '@angular/common/http';

import {HttpUtil} from '../HttpUtil';

@Injectable()
export class RuleRecordApi {

  constructor(public httpUtil: HttpUtil) {
  }

  ruleRecord(param: any) {
    const params = new HttpParams().set("token", localStorage.getItem("token"))
      .set("qrcode",param.qrcode)
      .set("latitude", param.latitude)
      .set("longitude", param.longitude)
      .set("positionId",param.positionId)
      .set("resourceId", param.resourceId)
      .set("resourceCode", param.resourceCode)
      .set("resourceName", param.resourceName)
      .set("length", param.length)
      .set("width", param.width)
      .set("height", param.height)
      .set("weight", param.weight)
      .set("description", param.description)
      .set("picUrl", param.picUrl);
    return this.httpUtil.post("/api/ruleRecord/saveRecord", params);
  }


  /**
   * 扫描货物
   * @param param
   * @returns {Observable<any>}
   */
  scanMateriel(param: any) {
    const params = new HttpParams().set("token", localStorage.getItem("token")).set("qrcodeStr", param.qrcode);
    return this.httpUtil.get("/api/ruleRecord/scanMateriel", params);
  }

}
